#!/bin/sh


# path=../

echo -e "\033[32m start git \033[0m"

cd ..

git status

result=$(git status | grep clean)

if [[ "$result" != "" ]]; then
  cmd /k dir
fi

echo -e "\033[32m start add \033[0m"

git add .

echo $?

commit=''
if [[ "$#" > 0 ]];then
 commit=$1
else 
 read -p "请输入本次提交信息：" commit
fi

git commit -m "$commit"


if [[ "$?" != 0 ]];then
 echo -e "\033[41m commit fail \033[0m" 
 cmd /k dir
fi


echo -e "\033[32m start pull  \033[0m" 

git pull

if [[ "$?" != 0 ]];then
 echo -e "\033[41m pull fail \033[0m" 
 cmd /k dir
fi

git push

# 阻止关掉窗口
cmd /k dir